package cn.gson.crm.controller.interview;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.AccessoryDao;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONArray;

/**
 * Servlet implementation class DeleteAccessoryServlet
 */
@WebServlet("/delete/accessory")
public class DeleteAccessoryServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");

		String jsonStr = JSONArray.toJSONString(new AccessoryDao().deleteAccessory(Integer.parseInt(id)));
		response.getWriter().append(jsonStr);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
